package com.winbomb.kingcard.screens;

import com.winbomb.kingcard.Assets;
import com.winbomb.kingcard.framework.Game;
import com.winbomb.kingcard.framework.Pixmap;
import com.winbomb.kingcard.framework.Screen;
import com.winbomb.kingcard.framework.Input.TouchEvent;

public class GameHelpScreen extends Screen {

	private static final int STEP_NUM = 13;
	private int stepNum = 1;

	private static final Pixmap[] bgs = new Pixmap[] { Assets.h1_bg1, Assets.h1_bg1, Assets.h1_bg1, Assets.h1_bg1,
			Assets.h1_bg1, Assets.h1_bg2, Assets.h1_bg1, Assets.h1_bg1, Assets.h1_bg1, Assets.h1_bg1, Assets.h1_bg1,
			Assets.h1_bg1, Assets.h1_bg3 };
	private static final Pixmap[] steps = new Pixmap[] { Assets.h1_s1, Assets.h1_s2, Assets.h1_s3, Assets.h1_s4,
			Assets.h1_s5, Assets.h1_s6, Assets.h1_s7, Assets.h1_s8, Assets.h1_s9, Assets.h1_s10, Assets.h1_s11,
			Assets.h1_s12, Assets.h1_s13 };

	public GameHelpScreen(Game game) {
		super(game);
		this.stepNum = 1;
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}

	@Override
	public void present(float deltaTime) {
		// draw bg
		g.drawPixmap(bgs[stepNum - 1], 0, 0);
		g.drawPixmap(steps[stepNum - 1], 0, 0);
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(float deltaTime) {
		updateTouchEvents();

		for (TouchEvent event : touchEvents) {
			if (event.type != TouchEvent.TOUCH_UP) {
				continue;
			}

			// 结束

			if (stepNum < STEP_NUM) {
				stepNum++;
			} else {
				game.setScreen(new MainScreen(game));
			}
		}

	}

}
